
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="MOBAN">

<meta name="description" content="">
<meta name="keywords" content="bootstrap, bootstrap5">
<link rel="preconnect" href="https://fonts.googleapis.com/">
<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin="">
<link href="static/css/css2.css" rel="stylesheet">
<link rel="stylesheet" href="static/css/style.css">
<link rel="stylesheet" href="static/css/flaticon.css">
<link rel="stylesheet" href="static/css/bootstrap-icons.css">
<link rel="stylesheet" href="static/css/tiny-slider.css">
<link rel="stylesheet" href="static/css/aos.css">
<link rel="stylesheet" href="static/css/glightbox.min.css">
<link rel="stylesheet" href="static/css/style1.css">
<link rel="stylesheet" href="static/css/flatpickr.min.css">
<link rel="short icon" href="images/28.jpg">
<title>知文招标网 - 个人中心</title>
<style>
.mt-2:hover {
	background-color: red !important;
}

.mt-4:hover {
	background-color: red !important;
}
</style>
</head>
<body>
	<div class="site-mobile-menu site-navbar-target">
		<div class="site-mobile-menu-header">
			<div class="site-mobile-menu-close">
				<span class="icofont-close js-menu-toggle"></span>
			</div>
		</div>
		<div class="site-mobile-menu-body"></div>
	</div>
	<nav class="site-nav">
		<div class="container" id="chw">
			<div class="menu-bg-wrap">
				<div class="site-navigation">
					<div class="row g-0 align-items-center">
						<div class="col-2">
							<a href="index.html" class="logo m-0 float-start">知文项目管理<span
								class="text-primary">.</span></a>
						</div>
						<div class="col-8 text-center">
							<form action="#" class="search-form d-inline-block d-lg-none">
								<input type="text" class="form-control" placeholder="Search...">
								<span class="bi-search"></span>
							</form>
							<ul
								class="js-clone-nav d-none d-lg-inline-block text-start site-menu mx-auto">
								<li><a href="index.html">首页</a></li>

								<li class="allPost"><a href="blog.html">全部帖子</a>
								<li><a href="category.html">分类</a></li>
								<li><a href="about.html">关于我们</a></li>
								<li id="toLogin1" class="active"><a href="login.html"
									id="toLogin">请先登录</a></li>
							</ul>
						</div>
						<div class="col-2 text-end">
							<a href="#"
								class="burger ms-auto float-end site-menu-toggle js-menu-toggle d-inline-block d-lg-none light">
								<span></span>
							</a>
							<form action="" onsubmit="return false" class="search-form d-none d-lg-inline-block">
								<input type="text" class="form-control" placeholder="搜索..." id="searchContent" @keydown.enter="search">
								<span class="bi-searchs"></span>
							</form>
						</div>

					</div>
				</div>
			</div>
		</div>
	</nav>
	<div class="cbt">
		<div class="hero overlay inner-page bg-primary py-5">
			<div class="container">
				<div
					class="row align-items-center justify-content-center text-center pt-5">
					<div class="col-lg-6">
						<h1 class="heading text-white mb-3" data-aos="fade-up">个人中心</h1>
					</div>
				</div>
			</div>
		</div>
		<div class="section">
			<div class="container">
				<div class="row">
					<div class="col-lg-4 mb-5 mb-lg-0" data-aos="fade-up"
						data-aos-delay="100">
						<div class="contact-info">
							<a href="javascript:void(0)" @click="myInfo">
								<div class="email mt-4"
									style="height: 55px; width: 400px; border: 1px solid red; margin-top: 0px !important; background-color: red"
									id="myInfo">
									<i class="icon-person" style="margin-top: 5px !important"></i>
									<h4 class="mb-2" style="margin-top: 16px !important">个人信息</h4>
									<br>
								</div>
							</a> <a href="javascript:void(0)" @click="myPublish">
								<div class="address mt-2"
									style="height: 55px; width: 400px; border: 1px solid red; background-color: #0dcaf0; margin-top: 0px !important;"
									id="myPublish">
									<i class="icon-heart" style="margin-top: 5px !important"></i>
									<h4 class="mb-2" style="margin-top: 16px !important">我发布的</h4>
									<br>
								</div>
							</a> <a href="javascript:void(0)" @click="myMessage">
								<div class="open-hours mt-4"
									style="height: 55px; width: 400px; border: 1px solid red; margin-top: 0px !important; background-color: #0dcaf0"
									id="myMessage">
									<i class="icon-message" style="margin-top: 5px !important"></i>
									<h4 class="mb-2" style="padding-top: 16px !important">我的评论</h4>
									<br>
								</div>
							</a> <a href="add.html">
								<div class="phone mt-4 ccc"
									style="height: 55px; width: 400px; border: 1px solid red; margin-top: 0px !important; background-color: #0dcaf0">
									<i class="icon-add" style="margin-top: 5px !important"></i>
									<h4 class="mb-2" style="margin-top: 16px !important">发布帖子</h4>
									<br>
								</div>
							</a> <a href="javascript:void(0)" @click="exitLogin">
								<div class="phone mt-4 ccc"
									style="height: 55px; width: 400px; border: 1px solid red; margin-top: 0px !important; background-color: #0dcaf0">
									<i class="icon-remove" style="margin-top: 5px !important"></i>
									<h4 class="mb-2" style="margin-top: 16px !important">退出登录</h4>
									<br>
								</div>
							</a>
						</div>
					</div>
					<!-- 警戒线 -->
					<div class="col-lg-8" data-aos="fade-up" data-aos-delay="200"
						style="display: block" id="myInfoContent">
						<div class="row">
							<div class="col-6 mb-3">
								用户名:<input type="text" class="form-control"
									:value="member.nickName" id="nickName">
							</div>
							<div class="col-6 mb-3"
								style="width: 100px; height: 100px; margin-left: 150px">
								<div id="showpic">
									<img v-if="member.photo != null" :src="'../../' + member.photo"
										style="width: 100%; height: 100%" id="photo"> <img
										v-else src="static/picture/person_1.jpg"
										style="width: 100%; height: 100%" id="photo">
								</div>
								<input type="file" placeholder="更换" style="margin-top: 25px"
									id="photos" name="photos" multiple="multiple"
									onchange="setImagePreviews(this, 'showpic')">
							</div>
							<div class="col-6 mb-3" style="margin-top: -35px">
								手机号:<input type="email" class="form-control" :value="member.tel"
									disabled="disabled" id="tel">
							</div>
							<div class="col-12 mb-3" style="margin-top: -20px">
								邮箱:<input type="text" class="form-control" :value="member.email"
									disabled="disabled">
							</div>
							<div class="col-12 mb-3" style="margin-top: -20px">
								输入密码(修改信息进行验证):<input type="password" class="form-control"
									id="pwd">
							</div>
							<div class="col-12 mb-3" style="margin-top: -20px">
								新密码(不修改密码则可无视):<input type="password" class="form-control"
									id="newPwd">
							</div>
							<div class="col-12">
								<input type="submit" value="修改" class="btn btn-primary"
									@click="change">
							</div>
						</div>
					</div>
					<!-- 警戒线 -->

					<!-- 警戒线 -->
					<div class="col-lg-8" data-aos="fade-up" data-aos-delay="200"
						style="display: none" id="myPublishContent">
							<div class="container">
								<div class="row mb-4">
									<div class="col-sm-6">
										<h2 class="posts-entry-title">我发布的</h2>
									</div>
								</div>
								<div class="row">
									<div class="col-lg-4 mb-4">
										<div class="post-entry-alt" v-for="item in myPosts" style="width:1332px">
											<a href="javascript:void(0)" class="img-link" style="width:100%;height:100%">
											<img :src="'../../' + item.photo" alt="Image" class="img-fluid" style="width: 444px; height: 227px"  @click="goTo(item.pno)">
											<span style="font-size:30px;width:300px;height:40px">{{item.title}}</span>
											<span style="width:300px;height:100px;margin-top:300px !important">{{item.time}}</span>
											<button style="float:right;margin-right:300px;margin-top:88px" @click="edit(item.pno)">编辑</button>
											<button style="float:right;margin-right:300px;margin-top:-88px" @click="del(item.pno)">删除</button>
											</a>
											<div class="excerpt">
												<a href="javascript:void(0)" class="read-more">查看更多</a>
												</p>
											</div>
										</div>
									</div>
								</div>
							</div>
					</div>
					<!-- 警戒线 -->
					<div id="myRemark" style="width:700px;height:100px;display:none" >
					     <div v-for="item in myReplys" style="width:100%;height:100%;border:1px solid red;background-color:grey">
					     	<div style="width:400px;height:30px;color:black;display:inline-block;margin-top:20px;margin-left:10px">发布时间: <span>{{item.time}}</span></div>
					     	<button style="margin-left:200px;height:30px" @click="delReply(item.rno)">删除</button>
					    	<div style="width:400px;height:30px;color:black;display:inline-block;margin-left:10px">评论内容: <span>{{item.content}}</span></div>
					     	<button style="margin-left:200px;height:30px;margin-top:7px" @click="goToSingle(item.pno)">跳转</button>
					     </div>
					</div>
					
				</div>
			</div>
		</div>
	</div>
	<div id="overlayer"></div>
	<div class="loader">
		<div class="spinner-border text-primary" role="status">
			<span class="visually-hidden">Loading...</span>
		</div>
	</div>
	<script src="static/js/bootstrap.bundle.min.js"
		type="b5ae548d54248ff8037e14c8-text/javascript"></script>
	<script src="static/js/tiny-slider.js"
		type="b5ae548d54248ff8037e14c8-text/javascript"></script>
	<script src="static/js/flatpickr.min.js"
		type="b5ae548d54248ff8037e14c8-text/javascript"></script>
	<script src="static/js/aos.js"
		type="b5ae548d54248ff8037e14c8-text/javascript"></script>
	<script src="static/js/glightbox.min.js"
		type="b5ae548d54248ff8037e14c8-text/javascript"></script>
	<script src="static/js/navbar.js"
		type="b5ae548d54248ff8037e14c8-text/javascript"></script>
	<script src="static/js/counter.js"
		type="b5ae548d54248ff8037e14c8-text/javascript"></script>
	<script src="static/js/custom.js"
		type="b5ae548d54248ff8037e14c8-text/javascript"></script>
	<script async="" src="static/js/js.js"
		type="b5ae548d54248ff8037e14c8-text/javascript"></script>
	<script type="b5ae548d54248ff8037e14c8-text/javascript">window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag("js", new Date()); gtag("config", "UA-166033648-1");</script>
	<script src="static/js/rocket-loader.min.js"
		data-cf-settings="b5ae548d54248ff8037e14c8-|49" defer=""></script>


	<!-- jquery vue -->
	<script src="js/jquery-3.6.0.js"></script>
	<script src="js/vue.js"></script>
	<script type="text/javascript" src="../back/js/ajaxfileupload.js"
		charset="utf-8"></script>
	<script src="js/axios.min.js"></script>
	<script src="js/show-dialog.js"></script>
	<script src="js/checkLogin.js"></script>
	<!--  <script type="text/javascript" src="../back/js/showpic.js" charset="utf-8"></script>-->
	<script>
	     let app1 = new Vue({
	    	 el:'.cbt',
	    	 data:{
	    		 member:[],
	    		 fileName:'',
	    		 myPosts:[],
	    		 myReplys:[]
	    	 },
	    	 methods:{
	    		 change(){
	    			 let nickName = $("#nickName").val();
	    			 let pwd = $("#pwd").val();
	    			 let newPwd = $("#newPwd").val();
	    			 let photo = $("#photo").attr("src");
	    			 let newphoto = $("#newPhoto").val();
	    			 console.log(nickName,pwd,newPwd,photo,newphoto)
	    			 
	    			 let obj = [];
	    			 obj.nickName = nickName;
	    			 obj.pwd = pwd;
	    			 if(newPwd != "" && newPwd != null){
	    				 obj.email = newPwd;
	    			 }
	    			 obj.tel = $("#tel").val();
	    			 
	    			 $.ajaxFileUpload({
						url:"../../member/changeInfo",
						secureuri:false,
						fileElementId:"photos",
						data:obj,
						dataType:"json",
						success:function(rt,status){
							if(rt.code == 511){
								showmsg("输入信息不完整,请确认后提交...");
								return false;
							}
				
							if(rt.code == 700){
								showmsg("请先登录...","red",function(){
								location.href="login.html";
								return false;
							  })
							}
							
							if(rt.code == 522){
								showmsg("密码错误...","red");
								return false;
							}
				
							if(rt.code == 200){
								$("#showpic").html("");  //清空图片预览
								showmsg("修改成功,正在重新登陆...","green",function(){
									sessionStorage.removeItem("mno");
									sessionStorage.removeItem("nickName");
									location.href="login.html";
								});
								return false;
				 			}
							showmsg("修改失败...","red");
						},
						 error:function(rt,status,e){
					 		 showmsg("修改信息失败\n","red");
						}
				  	})
	    		},
	    		exitLogin(){
	    			sessionStorage.removeItem("mno");
	    			sessionStorage.removeItem("nickName");
	    			location.href="../../member/loginout";
	    		},
	    		myPublish(){
	    			$("#myInfo").css("background-color","#0dcaf0");
	    			$("#myMessage").css("background-color","#0dcaf0");
	    			$("#myPublish").css("background-color","red");
	    			$("#myInfoContent").css("display","none");
	    			$("#myPublishContent").css("display","block");
	    			$("#myRemark").css("display","none");
	    		},
	    		myInfo(){
	    			$("#myInfo").css("background-color","red");
	    			$("#myMessage").css("background-color","#0dcaf0");
	    			$("#myPublish").css("background-color","#0dcaf0");
	    			$("#myInfoContent").css("display","block");
	    			$("#myPublishContent").css("display","none");
	    			$("#myRemark").css("display","none");
	    		},
	    		myMessage(){
	    			$("#myInfo").css("background-color","#0dcaf0");
	    			$("#myMessage").css("background-color","red");
	    			$("#myPublish").css("background-color","#0dcaf0");
	    			$("#myInfoContent").css("display","none");
	    			$("#myPublishContent").css("display","none");
	    			$("#myRemark").css("display","block");
	    		},
	    		goTo(pno){
	    			sessionStorage.setItem("pno",pno);
	    			location.href="single.html";
	    		},
	    		edit(pno){
	    			sessionStorage.setItem("pno",pno);
	    			location.href="change.html";
	    		},
	    		goToSingle(pno){
	    			sessionStorage.setItem("pno",pno);
	    			location.href="single.html";
	    		},
	    		del(pno){
	    			let flag = confirm("确定删除吗,评论会一并删除?");
	    			if(flag){
	    			   $.post("../../post/del",{pno:pno},rt=>{
	    				    if(rt.code == 600){
	    				    	showmsg("传输数据出错,请稍后再试...","red");
	    				    }
	    				    
	    				    if(rt.code == 700){
	    				    	showmsg("登录信息有误,请先登录...","red",function(){
	    				    		location.href="login.html";
	    				    	});
	    				    }
	    				    
	    				    if(rt.code == 200){
	    				    	this.myPosts.forEach(item=>{
	    				    		if(item.pno == pno){
	    				    			this.myPosts.splice(item,1)
	    				    		}
	    				    	})
	    				    	this.myReplys.forEach(item=>{
	    				    		if(item.pno == pno){
	    				    			this.myReplys.splice(item,1)
	    				    		}
	    				    	})
	    				    	showmsg("删除成功...","green");
	    				    }
	    				    
	    				    if(rt.code == 500){
	    				    	showmsg("删除失败,请稍后再试...","red");
	    				    }
	    				    
	    			   },"json")
	    			  
	    			}
	    		},
	    		delReply(rno){
	    			let flag = confirm("确定要删除吗？");
	    			if(flag){
	    				$.post("../../reply/delReplyX",{rno:rno},rt=>{
	    					 if(rt.code == 600){
		    				    	showmsg("传输数据出错,请稍后再试...","red");
		    				    }
		    				    
		    				    if(rt.code == 700){
		    				    	showmsg("登录信息有误,请先登录...","red");
		    				    }
		    				    
		    				    if(rt.code == 200){
		    				    	this.myReplys.forEach(item=>{
		    				    		if(item.rno == rno){
		    				    			this.myReplys.splice(item,1)
		    				    		}
		    				    	})
		    				    	showmsg("删除成功...","green");
		    				    }
		    				    
		    				    if(rt.code == 500){
		    				    	showmsg("删除失败,请稍后再试...","red");
		    				    }
	    				},"json");
	    			}
	    		}
	    	 },
	    	 mounted:function(){
	    		if(sessionStorage.getItem("nickName") != "undefined" && sessionStorage.getItem("nickName") != null){
			 	 		$("#toLogin").html(sessionStorage.getItem("nickName"));
			 	 		$("#toLogin").attr("href","contact.html");
			 	} 
	    		
	    		if(sessionStorage.getItem("mno") == "undefined"){
	    			 showmsg("请先登录...","red",function(){
	    				 location.href="login.html"
	    			 })
	    		} 
	    		
	    		axios.post("../../member/getInfo",{}).then(rt=>{
	    			if(rt.data == null){
	    				 showmsg("请先登录...","red",function(){
		    				 location.href="login.html"
		    			 })
	    			}else{
	    				this.member = rt.data;
	    			}
	    		})
	    		
	    		axios.post("../../post/findByMno",{}).then(rt=>{
	    			this.myPosts = rt.data;
	    			this.myPosts.forEach(item=>{
	    				if(item.photo == null || item.photo == ''){
	    					 item.photo = item.pics.split(";")[0];
	    				}
	    			})
	    		})
	    		
	    		axios.post("../../reply/myReplys",{}).then(rt=>{
	    			if(rt.data.code == 700){
	    				showmsg("请先登录...","red",function(){
	    					sessionStorage.removeItem("mno");
	    					location.href="login.html";
	    				})
	    			}
	    			this.myReplys = rt.data.data;
	    		})
	    		
	    		
	    	 }
	     })
	     
	     function setImagePreviews(imagesObj,divid) {
	    	    $("#photo").css("display","none");
	    	    var dd = document.getElementById(divid);
	    	    dd.style.display="block";
	    	    dd.innerHTML = "";
	    	    var fileList = imagesObj.files;
	    	    for (var i = 0; i < fileList.length; i++) {            
	    	        dd.innerHTML += "<div style='float:left;border:2px solid #95B8E7;margin-right:10px;margin-bottom:10px' > <img id='"+divid+"_img" + i + "'  /> </div>";
	    	        var imgObjPreview = document.getElementById(divid+"_img"+i); 
	    	        if (imagesObj.files && imagesObj.files[i]) {
	    	            //火狐下，直接设img属性
	    	            imgObjPreview.style.display = 'block';
	    	            imgObjPreview.style.width = '100px';
	    	            imgObjPreview.style.height = '100px';
	    	            imgObjPreview.src = window.URL.createObjectURL(imagesObj.files[i]);
	    	        }else {
	    	            //IE下，使用滤镜
	    	            imagesObj.select();
	    	            var imgSrc = document.selection.createRange().text; //运用IE滤镜获取数据;
	    	            //alert(imgSrc);
	    	            var localImagId = document.getElementById("img" + i);
	    	            //必须设置初始大小
	    	            localImagId.style.width = "100px";
	    	            localImagId.style.height = "100px";
	    	            //图片异常的捕捉
	    	            try {
	    	                localImagId.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader( true,sizingMethod=scale,src = imgSrc)";  //scale：缩放图片以适应对象的尺寸边界。
	    	            }
	    	            catch (e) {
	    	                alert("您上传的图片格式不正确，请重新选择!");
	    	                return false;
	    	            }
	    	            imgObjPreview.style.display = 'none';
	    	            document.selection.empty(); //在当前网页下不能选择对象,也就是鼠标不能选中 
	    	        }
	    	    }  
	    	    return true;
	    	}
	</script>
</body>
</html>
